package com.l.d.app.library.eventbus;

import android.support.annotation.Nullable;

/**
 * Created by 林德 on 2017/4/5 11:06.
 * <p/>
 */
public class EventSendEntity
{
    @Nullable
    private final Object uniqueIdentifier;
    @Nullable
    private final Object msg;

    EventSendEntity(@Nullable Object uniqueIdentifier, @Nullable Object msg)
    {
        this.uniqueIdentifier = uniqueIdentifier;
        this.msg = msg;
    }

    @Nullable
    public <T> T uniqueIdentifier()
    {
        if (uniqueIdentifier == null) return null;
        try
        {
            //noinspection unchecked
            return (T) uniqueIdentifier;
        } catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }

    @Nullable
    public <T> T msg()
    {
        if (msg == null) return null;
        try
        {
            //noinspection unchecked
            return (T) msg;
        } catch (Exception e)
        {
            e.printStackTrace();
        }
        return null;
    }
}
